package com.winit.common.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.InetAddress;

/**
 * Created by wangjian on 16/6/24.
 */
public class SshUtil {

    static final Logger logger = LoggerFactory.getLogger(SshUtil.class);

    /**
     * 校验ip是否可连通
     * @param ip
     * @return
     */
    public static boolean validateIp(String ip){
        boolean flag = false;
        try {
            InetAddress address = InetAddress.getByName(ip);
            flag = address.isReachable(5000);
        } catch (Exception e) {
            logger.error("校验ip是否可用异常",e);
        }
        return flag;
    }
}
